import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @author <a href="mailto:enjie.xu@yunhutech.com">xiaoming</a>
 * @since 2021/6/25
 */
public class LockSupportDemo {
    public static void main(String[] args) {
        m1();
    }

    public static void m1() {
        Thread a = new Thread(()->{
            try {
                TimeUnit.SECONDS.sleep(3L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"come in");
            LockSupport.park();
            LockSupport.park();
            System.out.println(Thread.currentThread().getName()+"被唤醒");

        },"A");
        a.start();

        new Thread(()->{
            LockSupport.unpark(a);
            LockSupport.unpark(a);
            System.out.println(Thread.currentThread().getName()+"通知");
        },"B").start();
    }
}
